<template>
  <div class="flex_box">
    <template v-for="(item, index) in list">
      <img-card :key="index" :item="item"></img-card>
    </template>
  </div>
</template>

<script>
import ImgCard from '../components/img_card'

export default {
  name: 'img_page',
  components: {ImgCard},
  data () {
    return {
      list: [],
      scroll: 0,
      cacheScroll: 0,
      currPage: 1,
      currType: '',
      loadData: true,
      totalCount: 0,
      loading: false,
      dataList: []
    }
  },
  mounted () {
    this.getList()
  },
  watch: {
    $route: {
      handler (val) {
        console.log(val.query)
        this.currType = val.query.type
        this.currPage = 1
        this.list = []
        this.getList()
      }
    }
  },
  methods: {
    getList () {
      this.$http({
        url: this.$http.adornUrl('/commodity/commodity/history'),
        method: 'get',
        params: this.$http.adornParams({})
      }).then(({data}) => {
        console.log(data)
        this.list = data.list.reverse()
        console.log('tang==>', this.list)
        // this.list.forEach(l => {
        //   l.like = false
        // })
      })
    }
  }
}
</script>

<style scoped>
.flex_box {
  display: flex;
  justify-content: center;
  flex-flow: row wrap;
  align-content: flex-start;
  width: 1600px;
  margin: 0 auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
}
</style>
